package com.atguigu.hivemq.controller;

import com.atguigu.hivemq.service.ComsumerService;
import com.atguigu.springcloud.config.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 支付记录管理 前端控制器
 *
 * @author zhenyu
 * @since 2022-07-25
 */
@Api(value = "订阅主题", tags = "订阅主题")
@RestController
@RequestMapping("/comsumer")
@Slf4j
public class Controller {

  @Autowired
  private ComsumerService comsumerService;

  @PostMapping("/subscribe")
  @ApiOperation("MQTT消费者订阅消息")
  public Result<Object> subscribe(@RequestParam("topic") String topic){
    return comsumerService.subscribe(topic);
  }

}
